package edu.fyvtc.javaweb.demo.controller;

import edu.fyvtc.javaweb.demo.common.DemoResult;
import edu.fyvtc.javaweb.demo.common.ResultUtils;
import edu.fyvtc.javaweb.demo.model.House;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@ResponseBody
@Slf4j
public class AspectController {

    @RequestMapping("/method0")
    public String woShiDiYiMing() {
        log.info("method0");
        return "method0";
    }

    @RequestMapping("/method1")
    public String method1() {
        log.info("method1");
        return "method1";
    }

    @RequestMapping("/method2")
    public String method2(House house) {
        log.info("method2");
        return "method2";
    }

    @RequestMapping("/method3")
    public DemoResult method3(House house) {
        log.info("method3");

        return ResultUtils.success();
    }

    @RequestMapping("/method4")
    public DemoResult method4(House house, Integer num) {
        log.info("method4");
        if (house.getId().equals("hahaha")){
            log.info("id不是null");
        }
        return ResultUtils.success();
    }

    @RequestMapping("/method5")
    public DemoResult method5(Integer num, House house) {
        log.info("method5");
        return method4(house, num);
    }

}
